//
// Created by F1997 on 2024/4/12.
//

#ifndef MY_CTP_API_DEMO_INIREADER_H
#define MY_CTP_API_DEMO_INIREADER_H
#include "pch.h"

typedef std::map<std::string, std::string> ss_map;
class IniReader {
public:
    IniReader()	{}
    ~IniReader() {}

    bool ReadConfig(const std::string& filename);
    std::string ReadString(const char* section, const char* item, const char* default_value);
    int ReadInt(const char* section, const char* item, const int& default_value);
    double ReadFloat(const char* section, const char* item, const float& default_value);

private:
    void Trim(std::string& str);
    bool AnalyseLine(const std::string& line, std::string& section, std::string & key, std::string & value);

private:
    std::map<std::string, ss_map> settings_;
};


#endif //MY_CTP_API_DEMO_INIREADER_H
